package com.cobra.provider.service;

import com.cobra.DemoService;
import org.apache.dubbo.common.URL;
import org.apache.dubbo.config.annotation.Service;
import org.apache.dubbo.rpc.RpcContext;
@Service(version = "default")
public class DefaultDemoService implements DemoService {
    @Override
    public String sayHello(String name) {
        System.out.println("执行了服务" + name);
        URL url = RpcContext.getContext().getUrl();
        return String.format("version is default %s：%s, Hello, %s", url.getProtocol(), url.getPort(), name);
    }
}
